package com.sphd.restaurantsystem.presenter;


import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.info.RestaurantInfo;
import com.sphd.restaurantsystem.model.MarketModelImpl;
import com.sphd.restaurantsystem.view.MarketView;

/**
* Created by Hu on 2016/12/20
*/

public class MarketPresenterImpl implements MarketPresenter{
    MarketModelImpl marketModel;
    MarketView marketView;

    public MarketPresenterImpl(MarketView marketView) {
        this.marketView = marketView;
        marketModel=new MarketModelImpl();
    }

    @Override
    public void addData(String url) {
        marketView.showLoading();
        marketModel.sendUrl(url,this);
    }

    @Override
    public void sendError(VolleyError error) {
        marketView.dissLoading();
    }

    @Override
    public void recResInfo(RestaurantInfo restaurantInfo) {
        marketView.recResInfo(restaurantInfo);
        marketView.dissLoading();
    }

    @Override
    public void setIsCzUrl(String url) {
        marketView.showLoading();
        marketModel.sendSetUrl(url,this);
    }

    @Override
    public void recRes(int res) {
        marketView.recRes(res);
        marketView.dissLoading();
    }

    @Override
    public void setDisUrl(String s) {
        marketView.showLoading();
        marketModel.sendSetUrl(s,this);
    }
}